package com.example.uploadattachment.sftp;

import com.jcraft.jsch.ChannelSftp;
import org.apache.commons.pool2.impl.GenericObjectPool;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author 何逸诚
 * @date 2025/3/19 8:51
 * @description 连接池初始化
 */
@Configuration
public class SftpPoolInitializer {
    @Bean
    public GenericObjectPool<ChannelSftp> sftpPool(SftpFactory factory, GenericObjectPoolConfig<ChannelSftp> config) {
        config.setJmxEnabled(false);
        return new GenericObjectPool<>(factory, config);
    }
}
